//
//  LCViewController.m
//  BaiduAd
//
//  Created by iOS11luchao on 05/19/2018.
//  Copyright (c) 2018 iOS11luchao. All rights reserved.
//

#import "LCViewController.h"
#import "BaiduMobAdFirstViewController.h"//横幅广告

#import "BaiduMobAdSDK/BaiduMobAdPrerollDelegate.h"
#import "BaiduMobAdSDK/BaiduMobAdPreroll.h"

#import "LSZPromotionalGraphicDetailsVC.h"


@interface LCViewController ()
<BaiduMobAdPrerollDelegate>

@property (nonatomic,strong) BaiduMobAdPreroll *prerollAd;//

@end

@implementation LCViewController


- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}
- (void)viewDidLoad {
    [super viewDidLoad];

    [self setupUI];
}
- (void)setupUI {
    NSArray *array = @[@"点击加载横幅广告",@"点击加载非原生视频贴片",@"点击加载原生视频贴片",@"插屏贴片广告",@"点击加载福音网页视频贴片",@"信息流视频广告",@"信息流组图广告",@"信息流普通广告"];
    for (NSInteger i = 0; i < array.count; i++) {
        UIButton *button = [[UIButton alloc] init];
        NSString *strTitle;
        [button addTarget:self action:@selector(click:) forControlEvents:(UIControlEventTouchUpInside)];
        button.tag = i;
        strTitle = array[i];
        [button setTitle:strTitle forState:UIControlStateNormal];
        //横幅广告
        button.backgroundColor = arc4random_color;//调用随机色
        
        [self.view addSubview:button];
        CGFloat y = i * 50;
        button.frame = CGRectMake(100, 200+y, 80, 80);
        [button sizeToFit];
    }
}
//
- (void)click:(UIButton *)button {
    switch (button.tag) {
        case 0:
            [self click_1];
            break;
        case 1:
            [self click_2];
            break;
        case 2:
            [self click_3];
            break;
        case 3:
            [self click_4];
            break;
        case 4:
            [self click_5];
            break;
        case 5:
            [self click_6];
            break;
        case 6:
            [self click_7];
            break;
        case 7:
            [self click_8];
            break;
        default:
            break;
    }
}
//横幅广告
- (void)click_1 {
    BaiduMobAdFirstViewController *detailViewController = [[BaiduMobAdFirstViewController alloc] init];
    [self.navigationController pushViewController:detailViewController animated:NO];
}
//非原生视频贴片广告
- (void)click_2 {
    BaiduMobAdPrerollViewController *detailViewController = [[BaiduMobAdPrerollViewController alloc] init];
    [self.navigationController pushViewController:detailViewController animated:NO];
}
//原生视频贴片广告
- (void)click_3 {
    BaiduMobAdPrerollNativeViewController *detailViewController = [[BaiduMobAdPrerollNativeViewController alloc] init];
    [self.navigationController pushViewController:detailViewController animated:NO];
}
//插屏广告
- (void)click_4 {
    BaiduMobAdNormalInterstitialViewController *detailViewController = [[BaiduMobAdNormalInterstitialViewController alloc] init];
    [self.navigationController pushViewController:detailViewController animated:NO];
}
- (void)click_5 {
    LSZPromotionalGraphicDetailsVC *promotionalGraphicDetailsVC = [[LSZPromotionalGraphicDetailsVC alloc] init];
    //[self.navigationController pushViewController:promotionalGraphicDetailsVC animated:NO];
    [self presentViewController:promotionalGraphicDetailsVC animated:NO completion:nil];
}
//信息流视频广告
- (void)click_6 {
    NativeVideoTableViewController *detailViewController = [[NativeVideoTableViewController alloc] init];
    [self.navigationController pushViewController:detailViewController animated:NO];
}
//信息流组图广告
- (void)click_7 {
    LSZBStationPlayingInterfaceVC *detailViewController = [[LSZBStationPlayingInterfaceVC alloc] init];
    [self.navigationController pushViewController:detailViewController animated:NO];
}
//信息流普通 广告
- (void)click_8 {
    NativeTableViewController *detailViewController = [[NativeTableViewController alloc] init];
    [self.navigationController pushViewController:detailViewController animated:NO];
}

@end
